package com.springboot.cloud.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import com.springboot.cloud.entities.Article;

@Mapper
public interface ArticleMapper{
	List<Article> geta(@Param("0")int start,@Param("1")int limit);

	boolean adda(Article a);

	Article getone(@Param("0")int id);

	List<Article> getmyarticle(@Param("0")int id);

	List<Article> getfavorite(@Param("0")int id);


	@Update("update article set article.like = article.like+1 where id = #{0}")
	boolean add1ike(@Param("0")int id);
	
	@Update("update article set article.nolike = article.nolike+1 where id = #{0}")
	boolean addno1ike(@Param("0")int id);

	@Insert("insert into favorite values(null,#{0},#{1})")
	boolean addfavorite(@Param("0")int id, @Param("1")int aid);

}

